<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://java.sun.com/jsf/core">



<c:if test="#{homeController.logueado()}">
    <h3> <h:outputText value="Menú Sistema"/> </h3>

<h:form>

    <c:forEach items="#{menuController.listado()}" var="item">

        <c:set var="img" value="icono_menu.png"/>
        <c:if test="#{item.imagen.length() > 0}">
            <c:set var="img" value="#{item.imagen}"/>
        </c:if>

        <c:choose>

            <c:when test="#{item.action.length() > 0}">
                <h:graphicImage library="images" name="#{img}"/>
                <h:commandLink action="#{homeController.irA(item.action)}" value="#{item.nombre}"/>
            </c:when>

            <c:when test="#{item.url.length() > 0}">
                <h:graphicImage library="images" name="#{img}"/>
                <h:outputLink target="_blank" value="#{item.url}">  <h:outputText value="#{item.nombre}"/> </h:outputLink>
            </c:when>

            <c:otherwise> <h:outputText value="#{item.nombre}"/> </c:otherwise>

        </c:choose>
        <br />

    </c:forEach>

</h:form>

</c:if>

</ui:composition>
